<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ page import="com.lp.cfg.ProConfig"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<!DOCTYPE html>
<html>
<head>
<%@ include file="/WEB-INF/oss/iot/common/variable.jsp"%>
<%@ include file="/WEB-INF/oss/iot/common/variable_js.jsp"%>
<%@ include file="/WEB-INF/oss/iot/common/resource_lib.jsp"%>

<style type="text/css">
	.app-container{
		width: 100%;border-top:1px solid #ecf0f5;
		padding-top: 10px;
	}
	
	.box-white {
	    width: 97%;
	    min-width: 897px;
	    padding-bottom: 0;
	    margin: 0 auto;
	}
	.box {
	    padding: 10px;
	    border: 0!important;
	    position: relative;
	    border-radius: 3px;
	    background: #fff;
	    margin-bottom: 20px;
		margin: 0 auto;
	}
	.List-info{
		padding-top: 10px;
		padding-left: 10px;
	}
	.p-title{
		padding: 20px 0;
		font-size: 20px;
		margin-left: -50px;
	}
</style>
</head>
<body>
	<div>
		<div>
			<div class="mapContainer" >
				<div class="app-container">
					<div class="container-layout List-info">
						<div class="box join-device-box">
							<div class="clearfix" style="width: 600px;margin: 0 auto;">
								<div>
									<div class="ml-20" id="form_submit_add" config-option=" url:'/scene',
																			   submit:'.add-Btn',
																			   success:'sunccessReturn' " >
										<div id="form_submit_update"  config-option=" url:'/scene','method':'put',
																			   submit:'.add-Btn',
																			   success:'sunccessReturn' " >
											<div id="detail_get" config-option=" 'url':'/scene?id=$#init-id$',success:'getIdCallBack' ">
												<input id="init-id" type-name="id" type="hidden">
												
												<div class="form-line">
													<div class="float-left" style="width: 48%;  ">
														<span class="red">*</span>&nbsp;<span>项目名称：</span>
														<div class="pb-10 pt-10">
															<input placeholder="项目名称" validate="empty" type-name="name" class="input input-big" >
														</div>	
													</div>
													<div class="float-left" style="width: 48%;margin-left: 4%;" >
														<span class="red">*</span>&nbsp;<span>排序：</span>
													<div class="pb-10 pt-10">
														<input placeholder="显示顺序" value="1" type="number" validate="empty" type-name="seq" class="input input-big" >
													</div>	
													</div>
												</div>
												<div class="form-line">
													<div class="float-left" style="width: 48%;  ">
														<span class="red">*</span>&nbsp;<span>经度：</span>
														<div class="pb-10 pt-10">
															<input placeholder="经度" validate="empty" onclick="showMap()" type-name="lon" class="input input-big input-map" >
														</div>	
													</div>
													<div class="float-left" style="width: 48%;margin-left: 4%;" >
														<span class="red">*</span>&nbsp;<span>纬度：</span>
														<div class="pb-10 pt-10">
															<input placeholder="纬度" validate="empty" onclick="showMap()" type-name="lat" class="input input-big input-map" >
														</div>
													</div>
												</div>
                                                <div class="form-line">
													<span class="red">*</span>&nbsp;<span>省市 ：</span>
													<div id="distpicker" style="margin-top: 10px;margin-bottom: 10px">
														<select id="city1" type-name="province" class="input input-big" style="width: 49%;float: left"></select>
														<select id="city2" type-name="city" class="input input-big " style="width: 49%;float: left;margin-left: 10px"></select>
														<input style="display: none"  type-name="province_code" >
														<input style="display: none"  type-name="city_code" >
														<div style="clear: both"></div>
													</div>
												</div>

												<div class="form-line">
													<div class="float-left" style="width: 48%;  ">
														<span>项目描述：</span>
														<div class="pb-10 pt-10">
															<input placeholder="项目描述" type-name="description" class="input input-big" >
														</div>	
													</div>
													<div class="float-left" style="width: 48%;margin-left: 4%;" >
														<span>备注：</span>
														<div class="pb-10 pt-10">
															<input placeholder="备注信息"  type-name="remark" class="input input-big" >
														</div>	
													</div>
												</div>
												<div class="form-line clearfix  pb-10">
													<button onclick="parent.layer.close(index);" style="background: #aaa;" class="cancel-btn layui-btn ml-20 border-gray float-right">取消</button>
													<button class="add-Btn  ml-10 float-right layui-btn layui-btn-normal">保存</button>
												</div>
											</div>
										</div>
									</div>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</body>

<script type="text/javascript">

//获取窗口索引
var index = parent.layer.getFrameIndex(window.name); 

function sunccessReturn(){
	tip("成功");
	setTimeout(function() {
		// 添加成功
		parent.layer.close(index);
		parent.location.reload();
	}, 1000);
	
}

$(function(){
	// 初始化url参数
	var id = GetQueryString("id");
	if(validater.empty(id)){
		manual_form_submit($("#form_submit_add"))
	}else{
		$(".p-title").html("编辑项目");
		writeVal("init-id",id);
		manual_form_submit($("#form_submit_update"));
		manual_init_detail_get($("#detail_get"));
	}
	
	$(".cancel-btn").click(function(){
		forwardUrl("/iot/app_manager");
	})
})

</script>
</html>